<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2016/10/11 0011
 * Time: 上午 8:31
 */
$path = 'C:\images\apple.jpg';
$ext_pos = strrpos($path,'.')+1;
$ext = substr($path, $ext_pos);
 header('Content-type:text/html;charset=utf-8');
function getFileExt($path){
    $ext = substr($path,strrpos($path,'.')+1);
    return $ext;
}
$path = 'C:\images\apple.jpg';
$ext = getFileExt($path);
echo "<p>文件路径：$path</p>";
echo  "<p>文件后缀：$ext</p>";
